Skip to content

Use torch.set_default_device in conftest.py#232

Merged
ValerianRey merged 2 commits intomainfrom
use-default-device
Jan 6, 2025
Merged

Use torch.set_default_device in conftest.py#232
ValerianRey merged 2 commits intomainfrom
use-default-device

Conversation

@ValerianRey
Copy link
Copy Markdown
Contributor

@ValerianRey ValerianRey commented Jan 6, 2025

  • Force device to be cpu for some representation tests => It will be easier to test them that way. That's equivalent to what we had before.
  • Use set_default_device instead of always specifying the device => This makes our lines much shorter, and it makes it impossible to forget about the , device=DEVICE when instantiating a tensor.

CUDA tests still all pass and take roughly the same time as before so this works.

@ValerianRey ValerianRey added the cc: test Conventional commit type for changes to tests. label Jan 6, 2025
@ValerianRey ValerianRey self-assigned this Jan 6, 2025
@ValerianRey ValerianRey merged commit 2085690 into main Jan 6, 2025
@ValerianRey ValerianRey deleted the use-default-device branch January 6, 2025 20:47
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: test Conventional commit type for changes to tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant